package org.fududu.oauth2;

import com.google.common.collect.ImmutableList;

import java.util.List;

/**
 * OAuth 2.0 configuration interface.
 *
 * @author Fuchun
 * @since 1.0
 */
public interface OAuth2 {

    // oauth 2.0 protocol parameters or result keys:
    // ----------------------------------------------------------------------------------
    String ACCESS_TOKEN = "access_token";
    String CLIENT_ID = "client_id";
    String CLIENT_SECRET = "client_secret";
    String RESPONSE_TYPE = "response_type";
    String CODE = "code";
    String EXPIRES_IN = "expires_in";
    String REDIRECT_URI = "redirect_uri";
    String STATE = "state";
    String SCOPE = "scope";
    String GRANT_TYPE = "grant_type";
    String AUTHORIZATION_CODE = "authorization_code";
    String TOKEN_TYPE = "token_type";
    String REFRESH_TOKEN = "refresh_token";
    String ACCESS_TYPE = "access_type";
    String APPROVAL_PROMPT = "approval_prompt";
    String USERNAME = "username";
    /**
     * OAuth2.0 protocol parameter or grant type constant.
     */
    String PASSWORD = "password";
    // oauth 2.0 grant types
    String CLIENT_CREDENTIALS = "client_credentials";

    List<String> AUTHZ_REQUEST_PARAMS = ImmutableList.of(RESPONSE_TYPE, CLIENT_ID, REDIRECT_URI, SCOPE, STATE);
    List<String> CODE_AT_REQUEST_PARAMS = ImmutableList.of(GRANT_TYPE, CODE, REDIRECT_URI, CLIENT_ID, CLIENT_SECRET);
    List<String> PASSWD_AT_REQUEST_PARAMS = ImmutableList.of(GRANT_TYPE, USERNAME, PASSWORD, CLIENT_ID, CLIENT_SECRET, SCOPE);
    List<String> CLIENT_AT_REQUEST_PARAMS = ImmutableList.of(GRANT_TYPE, CLIENT_ID, CLIENT_SECRET, SCOPE);

    /** {@code approval_prompt} value only one. */
    String AP_FORCE = "force";

    // access_type values (online, offline)
    String ACCESS_TYPE_OFFLINE = "offline";
    String ACCESS_TYPE_ONLINE = "online";
}
